<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<div class="row">

</div>
<div class="row">
    <div class="col-lg-9">
        <div class="chat-panel panel panel-default">
            <div class="panel-heading">
                <i class="fa fa-bullhorn fa-fw"></i>
                Tin tức

            </div>
            <!-- /.panel-heading -->
            <div class="panel-body">
                <ul class="chat">
                    <?php
                    foreach ($this->items as $item) {
                        
                            if ($item->getEvent() == 1) {
                            ?>
                            <li class="left clearfix">
                                <span class="chat-img pull-left">
                                    <img src="<?php echo $this->ImageUrl() ?>/image/icon-hot.gif" alt="User Avatar" class="img-circle">
                                </span>
                                <div class="chat-body clearfix">
                                    <div class="header">
                                        <strong class="primary-font"><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')"><?php echo $item->getTitle() ?></a>
                                        <small class="text-muted">
                                            <i class="fa fa-clock-o fa-fw"></i> <?php echo GlobalLib::viewDate($item->getCreated()) ?>
                                        </small>
                                            </strong>
                                    </div>
                                    <p>
                                        <?php echo $item->getDescription() ?>
                                        <i class="pull-right"><i class=" fa fa-long-arrow-right"></i><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')">Đọc thêm</a></i>
                                    </p>
                                    
                                </div>
                            </li>
                        <?php } else { ?> 


<li class="left clearfix">
                                <span class="chat-img pull-left">
                                    <img src="<?php echo $this->ImageUrl() ?>/image/new_icon.gif" alt="User Avatar" class="img-circle">
                                </span>
                                <div class="chat-body clearfix">
                                    <div class="header">
                                        <strong class="primary-font"><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')"><?php echo $item->getTitle() ?></a>
                                        <small class="text-muted">
                                            <i class="fa fa-clock-o fa-fw"></i> <?php echo GlobalLib::viewDate($item->getCreated()) ?>
                                        </small>
                                            </strong>
                                    </div>
                                    <p>
                                        <?php echo $item->getDescription() ?>
                                        <i class="pull-right"><i class=" fa fa-long-arrow-right"></i><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')">Đọc thêm</a></i>
                                    </p>
                                    
                                </div>
                            </li>
                        <?php }
                    }
                    
                        
                    ?>
                </ul>
            </div>
        </div>
    </div>
        <div class="col-lg-3">
        <div class="chat-panel panel panel-default">
            <div class="panel-heading">
                <ul class="chat">
                    <li class="left clearfix">
                                <span class="chat-img pull-left">
                                    <strong class="primary-font">Tổng điểm mua:</strong>
                                </span>
                                <div class="chat-body clearfix">
                                    <div class="header">
                                        <strong class="pull-right text-muted">
                                         <?php if($this->chargesbuy==0){
                                             echo 0;
                                         } else {
                                             echo $this->chargesbuy;
                                         } ?> 
                                        </small>
                                    </div>
                                   
                                </div>
                            </li>
                           
                                        </strong>
                                    </div>
                                   
                                </div>
                            </li>
                </ul>

            </div>
            <!-- /.panel-heading -->
           
        </div>
    </div>
    <!-- /.panel-body -->
<div id="myModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;</button>
                    <h4 class="modal-title">
                        <center>
                            <strong id="title"></strong>
                        </center>
                    </h4>
                </div>
                <div class="modal-body">    
                    <strong id="description"></strong><br>
                    <p id="content"></p>
                    
                </div>                    
            </div>
        </div>
    </div>
    <!-- /.panel-footer -->
    <script type="text/javascript">
        $('#myModal').modal('hide');
function getNewsDetail(url,news_id,title_id,description,content_id){
    var params={
      news_id:news_id 
    };
    $.post(url,params,function(datas){
        $('#myModal').modal('show'); 
        var items=datas.split('[]');
        if(items[0]!=''){
           $('#title').html(items[0]);
           $('#description').html(items[1]);
           $('#content').html(items[2]);
        }
    });
}
        </script>